﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AgriculturalMachinery.Models
{
    public class NotifyRepository : AgriculturalMachinery.Models.INotifyRepository
    {
        AgriMachineDataContext amdc = new AgriMachineDataContext();

        public IQueryable<Notify> FindAllNotify()
        {
            return amdc.Notify;
        }

        public void AddNotify(Notify n)
        {
            amdc.Notify.InsertOnSubmit(n);
            amdc.SubmitChanges();
        }

        public void DeleteNotify(int id)
        {
            amdc.Notify.DeleteAllOnSubmit(from i in amdc.Notify
                                          where i.NotifyID == id
                                          select i);
            amdc.SubmitChanges();
        }
    }
}
